home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
netz
/
term
/
extras
/
source
/
term-source.lha
/
PasswordUserPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-07
|
4KB
|
183 lines
/*
** PasswordUserPanel.c
**
** Editing panel for password and user name
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
*/
#include "termGlobal.h"
enum { GAD_USERNAME=1000,GAD_PASSWORD,
GAD_USE,GAD_CANCEL
};
BYTE __regargs
PasswordUserPanel(struct PhoneEntry *Entry)
{
struct LayoutHandle *Handle;
BYTE MadeChanges = FALSE;
if(Handle = LT_CreateHandleTags(Window -> WScreen,
LH_LocaleHook, &LocaleHook,
LH_ExitFlush, FALSE,
TAG_DONE))
{
struct Window *PanelWindow;
UBYTE UserName[100],
Password[100];
strcpy(UserName,Entry -> Header -> UserName);
strcpy(Password,Entry -> Header -> Password);
LT_New(Handle,
LA_Type, VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, VERTICAL_KIND,
LA_LabelID, MSG_V36_0120,
TAG_DONE);
{
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_PASSWORDUSERPANEL_USER_NAME_GAD,
LA_STRPTR, UserName,
LA_Chars, 30,
LA_ID, GAD_USERNAME,
GTST_MaxChars, 99,
TAG_DONE);
LT_New(Handle,
LA_Type, STRING_KIND,
LA_LabelID, MSG_PASSWORDUSERPANEL_PASSWORD_GAD,
LA_STRPTR, Password,
LA_Chars, 30,
LA_ID, GAD_PASSWORD,
GTST_MaxChars, 99,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,
LA_Type,VERTICAL_KIND,
TAG_DONE);
{
LT_New(Handle,
LA_Type, XBAR_KIND,
LAXB_FullSize, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_New(Handle,LA_Type,HORIZONTAL_KIND,
LAGR_SameSize, TRUE,
LAGR_Spread, TRUE,
TAG_DONE);
{
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_USE_GAD,
LA_ID, GAD_USE,
LABT_ReturnKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_New(Handle,
LA_Type, BUTTON_KIND,
LA_LabelID, MSG_GLOBAL_CANCEL_GAD,
LA_ID, GAD_CANCEL,
LABT_EscKey, TRUE,
LABT_ExtraFat, TRUE,
TAG_DONE);
LT_EndGroup(Handle);
}
LT_EndGroup(Handle);
}
if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_PASSWORDUSERPANEL_PASSWORD_AND_USER_NAME_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
LAWN_HelpHook, &GuideHook,
LAWN_Parent, Window,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_RMBTrap, TRUE,
WA_Activate, TRUE,
TAG_DONE))
{
struct IntuiMessage *Message;
BOOLEAN Done = FALSE;
ULONG MsgClass,
MsgQualifier;
UWORD MsgCode;
struct Gadget *MsgGadget;
GuideContext(CONTEXT_PASSWORDUSER);
PushWindow(PanelWindow);
LT_ShowWindow(Handle,TRUE);
do
{
if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
break;
while(Message = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort))
{
MsgClass = Message -> Class;
MsgQualifier = Message -> Qualifier;
MsgCode = Message -> Code;
MsgGadget = (struct Gadget *)Message -> IAddress;
GT_ReplyIMsg(Message);
LT_HandleInput(Handle,MsgQualifier,&MsgClass,&MsgCode,&MsgGadget);
if(MsgClass == IDCMP_CLOSEWINDOW)
Done = TRUE;
if(MsgClass == IDCMP_GADGETUP)
{
switch(MsgGadget -> GadgetID)
{
case GAD_USE:
LT_UpdateStrings(Handle);
if(strcmp(Entry -> Header -> Password,Password))
MadeChanges = TRUE;
if(strcmp(Entry -> Header -> UserName,UserName))
MadeChanges = TRUE;
strcpy(Entry -> Header -> UserName,UserName);
strcpy(Entry -> Header -> Password,Password);
Done = TRUE;
break;
case GAD_CANCEL:
Done = TRUE;
break;
}
}
}
}
while(!Done);
PopWindow();
}
LT_DeleteHandle(Handle);
}
return(MadeChanges);
}